<?php
    $cs = Yii::app()->getClientScript();
    $cs->registerScriptFile('/scripts/ckeditor/ckeditor.js');
    $cs->registerScriptFile('/scripts/ckeditor/ckfinder/ckfinder.js');
    ?>
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'product-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array(
        'enctype'=>'multipart/form-data'
    )
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'category_id'); ?>
		<?php echo $form->textField($model,'category_id',array('size'=>11,'maxlength'=>11)); ?>
		<?php echo $form->error($model,'category_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'name_en'); ?>
		<?php echo $form->textField($model,'name_en',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'name_en'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'url_key'); ?>
		<?php echo $form->textField($model,'url_key',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'url_key'); ?>
	</div>

	<div class="row" style="display: none;">
		<?php echo $form->labelEx($model,'last_modified_time'); ?>
		<?php echo $form->textField($model,'last_modified_time',array('value'=>date('Y-m-d G:i:s'))); ?>
		<?php echo $form->error($model,'last_modified_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'title_en'); ?>
		<?php echo $form->textField($model,'title_en',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'title_en'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'content_en'); ?>
		<?php echo $form->textArea($model,'content_en',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'content_en'); ?>
	</div>

	<div class="row" style="display: none;">
		<?php echo $form->labelEx($model,'view_count'); ?>
		<?php echo $form->textField($model,'view_count'); ?>
		<?php echo $form->error($model,'view_count'); ?>
	</div>

	<div class="row" style="display: none;">
		<?php echo $form->labelEx($model,'created_at'); ?>
		<?php echo $form->textField($model,'created_at',array('value'=>date('Y-m-d G:i:s'))); ?>
		<?php echo $form->error($model,'created_at'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'price'); ?>
		<?php echo $form->textField($model,'price',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'price'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'price_en'); ?>
		<?php echo $form->textField($model,'price_en',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'price_en'); ?>
	</div>

	<div class="row" style="display: none;">
		<?php echo $form->labelEx($model,'index'); ?>
		<?php echo $form->textField($model,'index'); ?>
		<?php echo $form->error($model,'index'); ?>
	</div>

	<div class="row"  style="display: none;">
		<?php echo $form->labelEx($model,'promotion_price'); ?>
		<?php echo $form->textField($model,'promotion_price',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'promotion_price'); ?>
	</div>

	<div class="row" style="display: none;">
		<?php echo $form->labelEx($model,'promotion_price_en'); ?>
		<?php echo $form->textField($model,'promotion_price_en',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'promotion_price_en'); ?>
	</div>
	
	<div class="row">
		<label>Ảnh đại diện</label>
		<input type="file" name="image" id="input_image">
		<?php echo $form->error($model,'cvr_img'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->

<script language="JavaScript">
CKEDITOR.replace( 'Product[content]',
{
    filebrowserBrowseUrl : '/static/ckeditor/ckfinder/ckfinder.html',
    filebrowserImageBrowseUrl : '/static/ckeditor/ckfinder/ckfinder.html?type=Images',
    filebrowserFlashBrowseUrl : '/static/ckeditor/ckfinder/ckfinder.html?type=Flash',
    filebrowserUploadUrl : '/static/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    filebrowserImageUploadUrl : '/static/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    filebrowserFlashUploadUrl : '/static/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
}
);

CKEDITOR.replace( 'Product[content_en]',
{
    filebrowserBrowseUrl : '/static/ckeditor/ckfinder/ckfinder.html',
    filebrowserImageBrowseUrl : '/static/ckeditor/ckfinder/ckfinder.html?type=Images',
    filebrowserFlashBrowseUrl : '/static/ckeditor/ckfinder/ckfinder.html?type=Flash',
    filebrowserUploadUrl : '/static/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    filebrowserImageUploadUrl : '/static/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    filebrowserFlashUploadUrl : '/static/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
}
);


</script>